/* var_pool.h */

#ifndef DODO_VAR_POOL_H
#define DODO_VAR_POOL_H

#include <list>
#include "defines.h"
#include "var_info.h"

namespace dodomet
{
namespace mm5
{
// fwd decl
class MM5_File;

/// Var_Pool is the class that holds infomation of variables.
/**
 * Variables from different MM5_File s can be merged in to a Var_Pool.
 */
class Var_Pool
{
public:
public:
	typedef std::list<Var_Info>::iterator iterator;
	typedef std::list<Var_Info>::const_iterator const_iterator;

	/// adding a new MM5_File into this Var_Pool
	/**
	 * Variables in the MM5_File will be merged automaticly.
	 * Duplicates won't be introduced.
	 */
	void add_mm5_file(const MM5_File& mm5_file);

//	queries

	/// returns iterator to the begin of the variable list
	iterator begin();

	/// returns iterator to the end of the variable list;
	/**
	 * remember end means the position next to the last element.
	 */
	iterator end();

	/// returns const_iterator to the begin of the variable list
	const_iterator begin() const;

	/// returns const_iterator to the end of the variable list;
	/**
	 * remember end means the position next to the last element.
	 */
	const_iterator end() const;
	
	/// returns total number of the variables.
	int var_num() const;

	/// returns iterator to the variable with that name. 
	/**
	 * when not found, returns end();
	 */
	iterator find_var_name(const std::string& var_name);

	/// returns const_iterator to the variable with that name. 
	/**
	 * when not found, returns end();
	 */
	const_iterator find_var_name(const std::string& var_name) const;
private:
	
private:
	std::list<Var_Info> vars_;
};

} // namespace dodomet::mm5
} // namespace dodomet

#endif //DODO_VAR_POOL_H

